<%--
    Document   : cliente
    Created on : 08/10/2010, 17:42:00
    Author     : renan
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">


<%@taglib prefix="f" uri="http://java.sun.com/jsf/core"%>
<%@taglib prefix="h" uri="http://java.sun.com/jsf/html"%>
<%@taglib prefix="a4j" uri="http://richfaces.org/a4j"%>
<%@taglib prefix="rich" uri="http://richfaces.org/rich"%>

<f:view>
    <h:form id="LSReserva">
        <html>
            <head>
                <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
                <link rel="stylesheet" type="text/css" href="../../css/style.css">
                <script type="text/javascript" src="../../js/funcoes.js"></script>
                <style type="text/css">

                    .marcar {
                        width: 10%;
                        text-align: center;
                    }

                    .acao{
                        width: 10%;
                        text-align: center;
                    }
                    .nome{
                        width: 30%;
                        text-align: left;
                    }
                    .celular{
                        width: 20%;
                        text-align: center;
                    }
                    .email{
                        width: 30%;
                        text-align: left;
                    }
                </style>
                <title>Manutenção de Reserva</title>
            </head>
            <body onload="foco();">
                <!--  BOTÕES PADRÔES  -->
                <table width="100%">
                    <tr>
                        <td align="left">
                            <h:commandButton id="btInserir"  image="../../imagens/salvar.png" action="#"
                                             title="Inserir novo registro" onmouseover="mouseSobre(this);" onmouseout="mouseSai(this);"
                                             onmousedown="mouseClicou(this);" onmouseup="mouseDesclicou(this);"/>
                            <a4j:status>
                                <f:facet name="start">
                                    <h:graphicImage value="../../imagens/ajax-loader.gif"/>
                                </f:facet>
                            </a4j:status>
                        </td>
                        <td align="right">
                            <input type="image" src="../../imagens/sair.png" onclick="window.close(); return false"
                                   title="Fechar" onmouseover="mouseSobre(this);" onmouseout="mouseSai(this);"
                                   onmousedown="mouseClicou(this);" onmouseup="mouseDesclicou(this);" >
                        </td>
                    </tr>
                </table>
                <table width="100%">
                    <tr>
                        <td>
                            <rich:panel id="painelLista">
                                <f:facet name="header">
                                    <h:outputText value="Manutenção de Usuários"></h:outputText>
                                </f:facet>
                                <h:panelGrid columns="1" styleClass="rotulo">

                                    <!-- FILTRO LISTA -->
                                    <table width="100%">
                                        <tr>
                                            <td>
                                                <fieldset><legend>Pesquisar</legend>
                                                    <table width="567px">
                                                        <tr>
                                                            <td align="left" class="rotulo">
                                                                Situação:
                                                            </td>
                                                            <td>
                                                                <h:selectOneMenu id="situacao" value="#{reservaFrm.situacaoSelecionada}" styleClass="campo"
                                                                                 onfocus="ganhouFoco(this);" onblur="perdeuFoco(this);">
                                                                    <f:selectItems value="#{reservaFrm.situacao}"/>
                                                                </h:selectOneMenu>
                                                            </td>
                                                            <td>
                                                                <a4j:commandButton id="btPesquisar" value="Pesquisar" action="#{reservaFrm.pesquisar}"
                                                                                   reRender="tabela,erros" title="Pesquisar Registros"
                                                                                   styleClass="campo"/>
                                                            </td>
                                                        </tr>
                                                    </table>
                                                </fieldset>
                                            </td>
                                        </tr>
                                    </table>
                                </h:panelGrid>
                            </rich:panel>
                        </td>
                    </tr>
                </table>
                <!-- LISTA DE DADOS -->
                <table width="100%">
                    <tr>
                        <td>
                            <div class="divTabela" style="height: 320px; width:100%">
                                <rich:dataTable id="tabela" cellspacing="1" width="97%" styleClass="margin:0px;"
                                                columnClasses="marcar,acao,nome,celular,email" value="#{reservaFrm.colecao}" var="item"
                                                onRowMouseOver="focoLinha(this);" onRowMouseOut="desfocoLinha(this);">
                                    <h:column>
                                        <f:facet name="header">
                                            <a4j:commandLink  styleClass="linkGrid" action="#" title="marcar" reRender="tabela" oncomplete="foco();">
                                                <a4j:actionparam name="coluna" value="marcar" />
                                                <h:outputText value="X" />
                                            </a4j:commandLink>
                                        </f:facet>
                                        <h:selectBooleanCheckbox id = "marcar"value=""/> 
                                    </h:column>
                                    <h:column>
                                        <f:facet name="header">
                                            <h:outputText styleClass="rotuloGrid" value="AÇÃO"/>
                                        </f:facet>
                                        <%-- BOTÕES DA GRID --%>
                                        <a4j:commandButton title="Deletar o registro" action="#" image="../../imagens/lsExcluir.png" onclick="if(!window.confirm('Confirma exclusão de registro?')){foco();return false;}" reRender="tabela,erros"/>
                                    </h:column>
                                    <h:column>
                                        <f:facet name="header">
                                            <a4j:commandLink action="#" reRender="tabela" oncomplete="foco();">
                                                <a4j:actionparam name="coluna" value="nome"/>
                                                <h:outputText value="NOME CLIENTE"/>
                                            </a4j:commandLink>
                                        </f:facet>
                                        <h:outputText value="#{item.reserva.cliente.nome}"/>
                                    </h:column>
                                    <h:column>
                                        <f:facet name="header">
                                            <a4j:commandLink action="#" reRender="tabela" oncomplete="foco();">
                                                <a4j:actionparam name="coluna" value="celular"/>
                                                <h:outputText value="CELULAR"/>
                                            </a4j:commandLink>
                                        </f:facet>
                                        <h:outputText value="#{item.reserva.cliente.celular}"/>
                                    </h:column>
                                    <h:column>
                                        <f:facet name="header">
                                            <a4j:commandLink action="#" reRender="tabela" oncomplete="foco();">
                                                <a4j:actionparam name="coluna" value="email"/>
                                                <h:outputText value="EMAIL"/>
                                            </a4j:commandLink>
                                        </f:facet>
                                        <h:outputText value="#{item.reserva.cliente.email}"/>
                                    </h:column>
                                </rich:dataTable>
                            </div>
                        </td>
                    </tr>
                </table>
                <!-- AREA DE MENSAGENS -->
                <table width="100%">
                    <tr>
                        <td>
                            <fieldset>
                                <h:panelGroup id="erros">
                                    <rich:messages globalOnly="true" layout="table" styleClass="textoErro">
                                        <f:facet name="errorMarker">
                                            <h:graphicImage value="../../imagens/important.png"/>
                                        </f:facet>
                                    </rich:messages>
                                </h:panelGroup>
                            </fieldset>
                        </td>
                    </tr>
                </table>
            </body>
        </html>
    </h:form>
    <script type="text/javascript">
        function foco() {
            el('LSReserva:btPesquisar').focus();
        }
    </script>
</f:view>

